<template>
   <div class="student">
        <h2>学生{{name}}</h2>
        <h2>年龄{{age}}</h2>
        <button @click="sendSchoolName"></button>
    </div>    
</template>

<script>
    import pubsub from 'pubsub-js'
     export default({
        name:'Student',
        data() {
            return {
                name:'weiwei',
                age:22
            }
        },
        methods:{
            sendSchoolName(n){
                // console.log(this);
            //    this.$bus.$emit('wei',this.name)
                pubsub.publish('weiwei','nihao')
            }       
        }
   })
</script>

<style>
    .student{
        background-color: skyblue;
    }
</style>